import { connect } from 'react-redux'
import { actions } from '../../store/reducers/count'
import CountUI from '../../components/Count'

const mapStateToProps = state => ({ count: state })

const mapDispatchToProps = dispatch => {
  const increment = number => dispatch(actions.increment(number))
  const decrement = number => dispatch(actions.decrement(number))
  const incrementAsync = (number, time) => dispatch(actions.incrementAsync(number, time))

  return {
    increment,
    decrement,
    incrementAsync
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(CountUI)
